#include<iostream>
using namespace std;
class Solution
{
public:
    string changeStr(string s)
    {
        string s1;
        for (auto ch : s)
        {
            if (ch != '#')
                s1 += ch;
            else
            {
                if (s1.size())
                    s1.pop_back();
            }
        }
        return s1;
    }
    bool backspaceCompare(string s, string t)
    {
        return changeStr(s) == changeStr(t);
    }
};
int main()
{
    string s = "a##c";
    string t = "#a#c";
    cout << Solution().backspaceCompare(s,t);
    return 0;
}